home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / MiniExamples / AppKit / PaginationLab / Worker.m < prev   
Text File  |  1995-06-12  |  1KB  |  58 lines

  1. /* BigView.m
  2.  * Purpose: This class functions as NXApp's delegate, initializing stuff
  3.  * before PaginationLab runs.  It also handles requests to run the
  4.  * pageLayout panel.
  5.  *
  6.  * You may freely copy, distribute, and reuse the code in this example.
  7.  * NeXT disclaims any warranty of any kind, expressed or  implied, as to its
  8.  * fitness for any particular use.
  9.  *
  10.  * Written by: Samuel Streeper
  11.  * Created: (04/April/91)
  12.  */
  13.  
  14. #import "Worker.h"
  15. #import "MyPageLayout.h"
  16. #import "MyPrintInfo.h"
  17.  
  18. @implementation Worker
  19.  
  20. - runPageLayout:sender
  21. {
  22.     [[MyPageLayout new] runModal];
  23.         
  24.     return self;
  25. }
  26.  
  27. - appDidInit:sender
  28. {
  29.     NXRect bvRect, cvRect;
  30.     NXPoint pt;
  31.     id newPi;
  32.     id clipView = [myBigView superview];
  33.  
  34.     [clipView allocateGState];    // otherwise halftone phase is wrong on scrolling
  35.     
  36.     // The following lines of code simply scroll the BigView so that
  37.     // it's top is showing, rather than it's coordinate origin.  Yes,
  38.     // I know this code is ugly...
  39.     
  40.     [myBigView getBounds:&bvRect];
  41.     [clipView getBounds:&cvRect];
  42.     pt = cvRect.origin;
  43.     pt.y = bvRect.size.height - cvRect.size.height;
  44.     [clipView rawScroll:&pt];
  45.     [[clipView superview] reflectScroll:clipView];
  46.     
  47.     //set the new modified PrintInfo, free the old one
  48.     newPi = [[MyPrintInfo alloc] init];
  49.     [[NXApp setPrintInfo: newPi] free];
  50.     [myBigView setPrintInfo:newPi];
  51.     
  52.     [[myBigView window] makeKeyAndOrderFront:self];
  53.     return self;
  54. }
  55.  
  56.  
  57. @end
  58.